package com.etl.user.common.enums;

/**
 * @author Arnold Yand
 * @summary 用户角色
 * @time 2018/3/24 17:56
 */
public enum UserRole {

  UNKNOWN(0, "未知"),
  CREDITOR(1, "债权人"), // 出借人
  DEBTOR(2, "债务人"), // 借款人
  GUARANTOR(3, "担保人"),
  ;

  private int code;
  private String label;
  private UserRole(int code, String label){
    this.code = code;
    this.label = label;
  }

  public UserRole parse(int code){
    for(UserRole v : UserRole.values()){
      if(v.code == code){
        return v;
      }
    }
    return UNKNOWN;
  }
}
